package com.gateway.common.dto.sync;

import com.gateway.common.enums.DataEventTypeEnum;

import java.io.Serial;
import java.io.Serializable;
import java.util.Objects;

/**
 * @program: api-gateway
 * @description:
 * @author: YuKai Fan
 * @create: 2025/2/5 16:00
 **/
public class PluginSyncData implements Serializable {

    @Serial
    private static final long serialVersionUID = 5970450806836920940L;
    /**
     * 插件id
     */
    private Long pluginId;

    /**
     * 插件名称
     */
    private String pluginName;

    /**
     * 数据操作类型
     */
    private DataEventTypeEnum eventType;

    /**
     * 版本号
     */
    private Integer version;

    /**
     * 环境变量
     */
    private String env;

    public PluginSyncData() {
    }

    public PluginSyncData(Long pluginId, String pluginName, DataEventTypeEnum eventType, Integer version, String env) {
        this.pluginId = pluginId;
        this.pluginName = pluginName;
        this.eventType = eventType;
        this.version = version;
        this.env = env;
    }

    public Long getPluginId() {
        return pluginId;
    }

    public void setPluginId(Long pluginId) {
        this.pluginId = pluginId;
    }

    public String getPluginName() {
        return pluginName;
    }

    public void setPluginName(String pluginName) {
        this.pluginName = pluginName;
    }

    public DataEventTypeEnum getEventType() {
        return eventType;
    }

    public void setEventType(DataEventTypeEnum eventType) {
        this.eventType = eventType;
    }

    public Integer getVersion() {
        return version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }

    public String getEnv() {
        return env;
    }

    public void setEnv(String env) {
        this.env = env;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        PluginSyncData that = (PluginSyncData) o;
        return Objects.equals(pluginId, that.pluginId) && Objects.equals(pluginName, that.pluginName) && eventType == that.eventType && Objects.equals(version, that.version) && Objects.equals(env, that.env);
    }

    @Override
    public int hashCode() {
        return Objects.hash(pluginId, pluginName, eventType, version, env);
    }

    @Override
    public String toString() {
        return "PluginSyncData{" +
                "pluginId=" + pluginId +
                ", pluginName='" + pluginName + '\'' +
                ", eventType=" + eventType +
                ", version=" + version +
                ", env='" + env + '\'' +
                '}';
    }
}
